#!/usr/bin/env bash

set -e

CLIB_DIR=$(cd $(dirname $0) && pwd)
BUILD_DIR=${CLIB_DIR}/build
rm -fr ${BUILD_DIR}
mkdir -p ${BUILD_DIR}
SO_PATH=${BUILD_DIR}/libsniffer.so
FIFO_PATH=
gcc -DSNIFFER_SO_PATH=\"${SO_PATH}\" \
    -DSNIFFER_FIFO_PATH=\"/tmp/command_sniffer_fifo\" \
    ${CLIB_DIR}/interceptor.c -shared -fPIC -o ${SO_PATH}